package github.remonlong.restfulutil.exception.enumeration;

import lombok.Getter;
import lombok.Setter;

/**
 * 请求状态码
 *
 * @author remon
 * @create 2018-08-10 11:53
 **/
public abstract class EnumResult {

    public static final EnumResult SYSTEM_ERROR = new EnumResult(-1, "未知异常") {
    };
    public static final EnumResult BASE_SUCCESS = new EnumResult(0, "请求成功") {
    };
    public static final EnumResult LOGIN_ERROR = new EnumResult(1001, "用户名或者密码错误") {
    };
    public static final EnumResult LOGIN_VALID_PASSWORD = new EnumResult(1001, "用户名或密码错误") {
    };
    public static final EnumResult LOGIN_TIMEOUT = new EnumResult(1002, "登录过期") {
    };
    public static final EnumResult LOGIN_ACC_VALID = new EnumResult(1003, "账户冻结") {
    };
    public static final EnumResult VALIDATION_ROLE = new EnumResult(1004, "权限校验失败") {
    };
    public static final EnumResult CLASS_INSTANT_FAIL = new EnumResult(1005, "对象初始化失败") {
    };
    public static final EnumResult PARAM_VALID_ERROR = new EnumResult(2001, "参数校验失败") {
    };
    public static final EnumResult NO_RECORD_FOUND = new EnumResult(2003,"未找到该记录") {
    };
    public static final EnumResult PARAM_VALID_PAGE = new EnumResult(2002, "pageNo 必须从1开始") {
    };

    @Getter
    @Setter
    private String msg;

    @Getter
    @Setter
    private Integer code;

    public EnumResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

}
